<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>用户管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="./layui/css/layui.css">
    <link rel="stylesheet" href="./layui/css/admin1.css">
    <style>
        .layadmin-tabs-select.layui-nav .layui-nav-child {
            left: -103px;
        }

        body {
            position: relative;
        }

        iframe {
            width: 100%;
            height: 100%;
        }

        .layui-side-menu .layui-nav .layui-nav-child .layui-nav-child a {
            padding-left: 60px;
        }
    </style>

</head>
<style>
    .layui-side-menu .layui-nav .layui-nav-item a {
        height: 35px;
        line-height: 35px;
    }

    .layui-side-menu .layui-nav .layui-nav-item .layui-icon {
        top: 52%;
    }
</style>

<body class="layui-layout-body">

    <div id="LAY_app" class="me">
        <div class="layui-layout layui-layout-admin">
            <!-- 顶部 -->
            <div class="layui-header">
                <!-- 头部区域 -->
                <ul class="layui-nav layui-layout-left">
                    <li class="layui-nav-item layadmin-flexible shousuo" lay-unselect>
                        <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                            <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                        </a>
                    </li>
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;" layadmin-event="refresh" title="刷新" onclick="reloadPage()">
                            <i class="layui-icon layui-icon-refresh-3"></i>
                        </a>
                    </li>
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                    <li class="layui-nav-item layui-hide-xs quanping" lay-unselect>
                        <a href="javascript:;" layadmin-event="fullscreen">
                            <i class="layui-icon layui-icon-screen-full"></i>
                        </a>
                    </li>
                    <!-- 头像 -->
                    <li class="layui-nav-item" lay-unselect style="right: 20px;">
                        <a href="javascript:;">
                            <cite class="name"></cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a class="xiugai">修改密码</a></dd>
                            <hr>
                            <dd layadmin-event="logout" style="text-align: center;"><a
                                    href="html/denglu/denglu.html">退出</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>

            <!-- 页面标签 -->
            <div class="layadmin-pagetabs" id="LAY_app_tabs">
                <!-- <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
                <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div> -->
                <div class="layui-icon layadmin-tabs-control layui-icon-down">
                    <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                        <li class="layui-nav-item" lay-unselect>
                            <a href="javascript:;"></a>
                            <dl class="layui-nav-child layui-anim-fadein">
                                <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                                <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                                <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                            </dl>
                        </li>
                    </ul>
                </div>
                <div class="layui-tab" style="margin-left: -40px;" lay-unauto lay-allowClose="true"
                    lay-filter="layadmin-layout-tabs">
                    <ul class="layui-tab-title fubiaoqian" id="LAY_app_tabsheader">
                        <li lay-id="./html/guanliyuan/guanliyuan.html" lay-attr="./html/guanliyuan/guanliyuan.html"
                            class="layui-this" onclick="zhidingyemian(event)">
                            <i class="layui-icon layui-icon-component"></i>
                        </li>
                    </ul>
                </div>
            </div>



            <!-- 侧边菜单 -->
            <div class="layui-side layui-side-menu">
                <div class="layui-side-scroll">
                    <div class="layui-logo" lay-href="home/console.html">
                        <span>文件上传管理系统</span>
                    </div>
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
                        lay-filter="layadmin-system-side-menu">
                        <li data-name="button" lay-tips="用户管理" class="layui-nav-item layui-nav-itemed layui-this yemian"
                            lay-href="./html/guanliyuan/guanliyuan.html" style="display: block">
                            <a href="javascript:;" lay-tips="用户管理" lay-direction="2">
                                <i class="layui-icon layui-icon-user"></i>
                                <cite>用户管理</cite>
                            </a>
                        </li>
                        <li data-name="button" lay-tips="文件搜索" class="layui-nav-item layui-nav-itemed layui-this yemian"
                            lay-href="./html/guanliyuan/wenjiansousuo.html" style="display: block;">
                            <a href="javascript:;" lay-tips="文件搜索" lay-direction="2">
                                <i class="layui-icon layui-icon-file"></i>
                                <cite>文件搜索</cite>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

            <!-- 主体内容 -->
            <div class="layui-body" id="LAY_app_body" style=" top: 80px;">
                <div class="layadmin-tabsbody-item layui-show">
                    <iframe id=" shouye" src="./html/guanliyuan/guanliyuan.html" height="550px" width="1200px"
                        frameborder="0">
                    </iframe>
                </div>
            </div>

            <!-- 辅助元素，一般用于移动设备下遮罩 -->
            <!-- <div class="layadmin-body-shade" layadmin-event="shade"></div> -->
        </div>
    </div>
</body>
<script src="./layui/layui.js"></script>
<script src="./layui/layui.all.js"></script>
<script src="./js/jquery-3.4.1.js"></script>

<script>
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
<!-- 切换页面的实现方法 -->
<script>
    $(document).ready(function () {
        $('.yemian').on('click', function () { //对添加页面进行监听    
            var that = this
            var cunzai = false;
            $.each($('.fubiaoqian')[0].children, function (index, item) {
                if (item.attributes[1].nodeValue == $(that)[0].attributes[3].nodeValue) {
                    cunzai = true
                }
            })
            if (cunzai) { //点击侧边栏   如果是已经打开了的页面   展示
                for (var i = 0; i < $('.fubiaoqian').children().length; i++) {
                    if ($(this)[0].attributes[3].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                        $('.layui-this').each(function () {
                            $(this).removeClass('layui-this')
                        })
                        $('.fubiaoqian').children()[i].classList.add('layui-this')
                        $('.layui-show').each(function () {
                            $(this).removeClass('layui-show')
                        })
                        if (i == 0) {
                            console.log(i)
                            $('#shouye').attr('src', './html/xinxiguanli.html');
                        }
                        $('.layui-body').children()[i].classList.add('layui-show')
                    }
                }
            } else { // 页面还没有打开   添加新元素(顶部和底部)(顶部要设置为layui-this)
                $('.layui-this').each(function () {
                    $(this).removeClass('layui-this')
                })
                $('.fubiaoqian')[0].innerHTML += '<li lay-id="' + $(this)[0].attributes[3].nodeValue + '" lay-attr="' + $(this)[0].attributes[3].nodeValue + '" class="layui-this" onclick="zhidingyemian(event)">' + $(this)[0].attributes[1].nodeValue + '<i class="layui-icon layui-unselect layui-tab-close" onclick="guanbi(event)">ဆ</i></li>';
                $('.layui-show').each(function () {
                    $(this).removeClass('layui-show')
                })
                $('.layui-body')[0].innerHTML += '<div class="layadmin-tabsbody-item layui-show"><iframe src="' + $(this)[0].attributes[3].nodeValue + '" frameborder="0"></iframe></div>';
            }

        })
    })

    function guanbi(event) { //这是关闭那个页面的方法   参数是在父结点中是第几个
        for (var i = 0; i < $('.fubiaoqian').children().length; i++) {
            if ($(event.target).parent()[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                $('.fubiaoqian').children()[i].remove()
                $('.layui-this').each(function () {
                    $(this).removeClass('layui-this')
                })
                $('.fubiaoqian').children()[i - 1].classList.add('layui-this')
                $('.layui-body').children()[i].remove()
                $('.layui-show').each(function () {
                    $(this).removeClass('layui-show')
                })
                $('.layui-body').children()[i - 1].classList.add('layui-show')
            }
        }
    }

    function zhidingyemian(event) { //点击页面可以显示指定的页面
        $('#shouye').attr('src', './html/xinxiguanli.html');
        for (var i = 0; i < $('.fubiaoqian').children().length; i++) {
            if ($(event.target)[0].attributes[1]) {
                if ($(event.target)[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                    $('.layui-this').each(function () {
                        $(this).removeClass('layui-this')
                    })
                    $('.fubiaoqian').children()[i].classList.add('layui-this')

                    $('.layui-show').each(function () {
                        $(this).removeClass('layui-show')
                    })
                    $('.layui-body').children()[i].classList.add('layui-show')
                }
            } else if ($(event.target).parent()[0].attributes[1].nodeValue == $('.fubiaoqian').children()[i].attributes[1].nodeValue) {
                $('.layui-this').each(function () {
                    $(this).removeClass('layui-this')
                })
                $('.fubiaoqian').children()[i].classList.add('layui-this')

                $('.layui-show').each(function () {
                    $(this).removeClass('layui-show')
                })
                $('.layui-body').children()[i].classList.add('layui-show')
            }

        }
    }

    $(".name")[0].innerText = window.localStorage.getItem("name")
</script>
<script>
    layui.data.theme = function () {
        layui.use('form', function () {
            var form = layui.form,
                admin = layui.admin;

            //监听隐藏开关
            form.on('switch(system-theme-sideicon)', function () {
                admin.theme({
                    hideSideIcon: this.checked
                })
            });
        });
    };
</script>
</div><span class="layui-layer-setwin"></span><span class="layui-layer-resize"></span></div> -->
<!-- 左边导航栏收缩的方法 -->
<script type="text/javascript">
    $('.shousuo ').on('click', function () {
        $('.layui-icon-shrink-right').toggleClass('layui-icon-spread-left');
        $('.me').toggleClass('layadmin-side-shrink');

    })
</script>
<!-- 刷新 -->
<script type="text/javascript">
    function reloadPage() {
        window.location.reload()
    }
</script>
<!-- // 全屏的方法 -->
<script type="text/javascript">
    $('.quanping').on('click', function () {
        var docElm = document.documentElement;
        if (docElm.requestFullscreen) {
            docElm.requestFullscreen();
        } else if (docElm.mozRequestFullScreen) {
            docElm.mozRequestFullScreen();
        } else if (docElm.webkitRequestFullScreen) {
            docElm.webkitRequestFullScreen();
        } else if (elem.msRequestFullscreen) {
            elem.msRequestFullscreen();
        }
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        }
    })
    $(".name")[0].innerText = window.localStorage.getItem("name")
</script>



<script>
    var form
    layui.use(["upload"], function () {
        form = layui.form;
        form.verify({
            password: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]

        })
    })
    $(".xiugai").click(function () {
        layer.open({
            content: `
<form class="layui-form" action="" lay-filter="xiugaimima">
  <div class="layui-form-item">
    <label class="layui-form-label" style="width:125px">新密码：</label>
    <div class="layui-input-inline">
        <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input new">
    </div>
  </div>  
  
</form>                       
                        `,
            area: ['400px'],
            btn: ['修改', '取消'],
            success: function () {

            },
            yes: function (index, layero) {
                var url = "http://47.105.118.98:9013"
                var xiugaimima = form.val("xiugaimima")
                console.log(xiugaimima)
                $.ajax({
                    url: url + "/user/updateManagerPassword",
                    method: "post",
                    data: {
                        password: xiugaimima.password,
                        userName: window.localStorage.getItem("username"),
                    }
                    ,
                    headers: {
                        token: localStorage.getItem('token')
                    },
                    success: function (data) {
                        console.log(data)
                        if (data.code === 200) {
                            layer.closeAll();
                            layer.msg("修改成功！")
                            layer.msg("您的新密码是：" + xiugaimima.password + "，请等待3秒自动退出到登录页面")
                            setInterval(function () {
                                window.location = './html/denglu/denglu.html'
                            }, 3000)

                        } else {
                            layer.msg(data.msg)
                        }
                    }
                }), function (data, status) {
                    console.log(data)
                    if (data.code == 200) {
                        //    window.location = './html/denglu/denglu.html'
                    }
                };
            },
            btn2: function (index, layero) {
                //    取消
            }
        })

    })
</script>

</html>